﻿/********************************************************************************
** @ Date:2024/09/01
** @ Author: Gaojia
** @ Description: VLC播放视频类
** @ Version:1.0.0
** @ Fun:
********************************************************************************/
#ifndef CVlcSdkOper_H
#define CVlcSdkOper_H
#include <vlc/vlc.h>
#include <QWidget>
#include <qthread.h>
class CVlcSdkOper : public QObject
{
	Q_OBJECT
public:
	CVlcSdkOper();
	~CVlcSdkOper();
	bool realPlay(const QString sRtspUrl, WId winId);
	bool realPlay(const QString sRtspUrl, WId winId,QString &sReInfo);
	bool stopRealPlay();
	bool stopRealPlayEx();
	void setSuspendText(const QString sShowText, const int nColorType);
private:
	bool stopVlcPlayerSafe(libvlc_media_player_t* player, int timeoutMs = 2000);
	bool waitTime(int nMs, bool& bRun);
	static void onVlcStopped(const libvlc_event_t*, void* opaque);
private:
	libvlc_instance_t *m_pVlcInstance;
	libvlc_media_player_t *m_pVlcMediaPlayer;
	libvlc_media_t *m_pMedia;
	bool m_bRealPlay;   //是否在预览
	bool m_bStopped;
};

#endif